clear all;

load('data_PSM.mat','data_treat','data_control','nvar')

avg(1:nvar-1,1:3)=0.0;
for i=1:nvar-1
    avg(i,1)=mean(data_treat(:,i+1));
    avg(i,2)=mean(data_control(:,i+1));
    v1=var(data_treat(:,i+1));
    v2=var(data_control(:,i+1));
    N1=length(data_treat(:,i+1));
    N2=length(data_control(:,i+1));
    
    avg(i,3)=(avg(i,1)-avg(i,2))/sqrt(v1/N1+v2/N2);
end

std1(1:nvar-1,1:2)=0.0;
for i=1:nvar-1
    std1(i,1)=std(data_treat(:,i+1));
    std1(i,2)=std(data_control(:,i+1));  
end

result(1:8,1:2)=0.0;
index=[1,2,3,4];
for i=1:4
    result(2*i-1,:)=avg(index(i),1:2);
    result(2*i,:)=std1(index(i),1:2);
end

